from pydantic_settings import BaseSettings


class Settings(BaseSettings):
    # Redis配置
    REDIS_HOST: str = "103.236.71.202"
    REDIS_PORT: int = 6387
    REDIS_DB: int = 0
    REDIS_PASSWORD: str = ""
    REDIS_MAX_CONNECTIONS: int = 10

    # MySQL配置
    MYSQL_HOST: str = "103.236.71.202"
    MYSQL_PORT: int = 3308
    MYSQL_USER: str = "root"
    MYSQL_PASSWORD: str = "138241"
    MYSQL_DATABASE: str = "lgy-account"
    MYSQL_CHARSET: str = "utf8mb4"



    # 应用配置
    APP_NAME: str = "AI智能体中心API服务"
    DEBUG: bool = False

    # JWT配置
    JWT_SECRET_KEY: str = "xdclass.net168xdclass.net168xdclass.net168xdclass.net168"
    JWT_ALGORITHM: str = "HS256"
    JWT_ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
    JWT_LOGIN_SUBJECT: str = "XDCLASS"

    # LLM配置
    LLM_MODEL_NAME: str = "deepseek-chat"
    LLM_BASE_URL: str = "https://api.deepseek.com"
    LLM_API_KEY: str = "sk-80bdd53049fc426793f192a02eebbf63"
    LLM_TEMPERATURE: float = 1
    LLM_STREAMING: bool = True
    # LLM配置（通义千问）
    LLM_MODEL_NAME_ALIBABA: str = "qwq-plus"
    LLM_BASE_URL_ALIBABA: str = "https://dashscope.aliyuncs.com/compatible-mode/v1"
    LLM_API_KEY_ALIBABA: str = "sk-442291ac0425424890ad4be037c4d468"

    #本地化云服务器部署LLM配置
    LLM_MODEL_NAME_LOCAL: str = "llama3:8b"
    LLM_BASE_URL_LOCAL: str = "http://103.236.71.196:11434"

    COZE_LLM_API_URL: str = "https://api.coze.cn/v3/chat"
    COZE_LLM_API_KEY: str = "pat_YqNSugcM8ePR8FgPGOH6x39kvDiKcmhzVk0uSAZbgVCgeJ5Wap0MHMoYLnamv9fl"
    # 扣子智能体id（bot_id）
    COZE_LLM_AGENT_ID: str = "7561608294780370990"
    

    
    Zhipu_API_KEY: str = "0af44eed48f94c13a7a5fad7ef5819b9.T5kFO5mpNwnFi3fb"
    Zhipu_API_URL: str = "https://open.bigmodel.cn/api/paas/v4/chat/completions"
    Zhipu_MODEL_NAME: str = "glm-4.5"


    #嵌入式模型配置
    EMBEDDING_MODEL_NAME: str = "mofanke/acge_text_embedding"
    # EMBEDDING_URL: str = "http://localhost:11434"
    EMBEDDING_URL: str = "http://103.236.71.196:11434"

    # 向量数据库配置
    MILVUS__HOST: str = "117.72.167.161"
    MILVUS__PORT: int = 19530
    MILVUS__HOST_AND_PORT: str = f"tcp://{MILVUS__HOST}:{MILVUS__PORT}"

    ALI_EMBEDDING_API_KEY:str = "sk-442291ac0425424890ad4be037c4d468"

    #智谱联网搜索
    Zhipu_search_api_key: str = "0af44eed48f94c13a7a5fad7ef5819b9.T5kFO5mpNwnFi3fb"
    Zhipu_search_url: str = "https://open.bigmodel.cn/api/mcp/web_search_prime/mcp"
    Zhipu_search_type: str = "http"
    
    # MaxKB配置
    MAXKB_API_URL: str = "http://www.lgy-cloud.site:18080/chat/api"
    MAXKB_API_KEY: str = "application-0fd46a953b7b62199c1586ed3dc86c56"
    MAXKB_PUBLIC_URL: str = "http://www.lgy-cloud.site:18080/chat/9533c0b2f19ba58f"
    MAXKB_BASE_URL: str = "http://www.lgy-cloud.site:18080/chat/api/019a9abe-6428-7ad1-a9b9-1ee0c750ef33"
    MAXKB_Chat_ID: str = "019aa717-4a0b-7b42-9374-13767cfde4d8"

    class Config:
        env_file = ".env"
        case_sensitive = True


settings = Settings()